<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>modbus_tk.simulator_rpc_client</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/modbus-tk/">Modbus Test Kit</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="modbus_tk-module.html">Package&nbsp;modbus_tk</a> ::
        Module&nbsp;simulator_rpc_client
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="modbus_tk.simulator_rpc_client-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="modbus_tk.simulator_rpc_client-module.html">Module modbus_tk.simulator_rpc_client</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#!/usr/bin/env python</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># -*- coding: utf-8 -*-</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring"> Modbus TestKit: Implementation of Modbus protocol in python</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-docstring"> (C)2009 - Luc Jean - luc.jean@gmail.com</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-docstring"> (C)2009 - Apidev - http://www.apidev.fr</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-docstring"> This is distributed under GNU LGPL license, see license.txt</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">socket</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Package modbus_tk=modbus_tk-module.html"><a title="modbus_tk" class="py-name" href="#" onclick="return doclink('link-0', 'modbus_tk', 'link-0');">modbus_tk</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module modbus_tk.defines=modbus_tk.defines-module.html"><a title="modbus_tk.defines" class="py-name" href="#" onclick="return doclink('link-1', 'defines', 'link-1');">defines</a></tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient"></a><div id="SimulatorRpcClient-def"><a name="L15"></a><tt class="py-lineno"> 15</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient-toggle" onclick="return toggle('SimulatorRpcClient');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html">SimulatorRpcClient</a><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="SimulatorRpcClient-expanded"><a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line">    <tt class="py-docstring">"""Make possible to send command to the modbus_tk.Simulator thanks to Remote Process Call"""</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line">     </tt>
<a name="SimulatorRpcClient.__init__"></a><div id="SimulatorRpcClient.__init__-def"><a name="L18"></a><tt class="py-lineno"> 18</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.__init__-toggle" onclick="return toggle('SimulatorRpcClient.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">host</tt><tt class="py-op">=</tt><tt class="py-string">"127.0.0.1"</tt><tt class="py-op">,</tt> <tt class="py-param">port</tt><tt class="py-op">=</tt><tt class="py-number">2711</tt><tt class="py-op">,</tt> <tt class="py-param">timeout</tt><tt class="py-op">=</tt><tt class="py-number">0.5</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.__init__-expanded"><a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line">        <tt class="py-docstring">"""Constructor"""</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">host</tt> <tt class="py-op">=</tt> <tt class="py-name">host</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">port</tt> <tt class="py-op">=</tt> <tt class="py-name">port</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">timeout</tt> <tt class="py-op">=</tt> <tt class="py-name">timeout</tt> </tt>
</div><a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">         </tt>
<a name="SimulatorRpcClient._rpc_call"></a><div id="SimulatorRpcClient._rpc_call-def"><a name="L24"></a><tt class="py-lineno"> 24</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient._rpc_call-toggle" onclick="return toggle('SimulatorRpcClient._rpc_call');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#_rpc_call">_rpc_call</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">query</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient._rpc_call-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient._rpc_call-expanded"><a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-docstring">"""send a rpc call and return the result"""</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line">        <tt class="py-name">sock</tt> <tt class="py-op">=</tt> <tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">socket</tt><tt class="py-op">(</tt><tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">AF_INET</tt><tt class="py-op">,</tt> <tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">SOCK_STREAM</tt><tt class="py-op">)</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-name">sock</tt><tt class="py-op">.</tt><tt class="py-name">settimeout</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">timeout</tt><tt class="py-op">)</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line">        <tt class="py-name">sock</tt><tt class="py-op">.</tt><tt class="py-name">connect</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">host</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">port</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line">        <tt class="py-name">sock</tt><tt class="py-op">.</tt><tt class="py-name">send</tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">        <tt class="py-name">response</tt> <tt class="py-op">=</tt> <tt class="py-name">sock</tt><tt class="py-op">.</tt><tt class="py-name">recv</tt><tt class="py-op">(</tt><tt class="py-number">1024</tt><tt class="py-op">)</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">        <tt class="py-name">sock</tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Method modbus_tk.modbus.Master.close()=modbus_tk.modbus.Master-class.html#close,Method modbus_tk.modbus_rtu.RtuServer.close()=modbus_tk.modbus_rtu.RtuServer-class.html#close,Method modbus_tk.simulator.ConsoleInterface.close()=modbus_tk.simulator.ConsoleInterface-class.html#close,Method modbus_tk.simulator.RpcInterface.close()=modbus_tk.simulator.RpcInterface-class.html#close,Method modbus_tk.simulator.Simulator.close()=modbus_tk.simulator.Simulator-class.html#close"><a title="modbus_tk.modbus.Master.close
modbus_tk.modbus_rtu.RtuServer.close
modbus_tk.simulator.ConsoleInterface.close
modbus_tk.simulator.RpcInterface.close
modbus_tk.simulator.Simulator.close" class="py-name" href="#" onclick="return doclink('link-2', 'close', 'link-2');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Method modbus_tk.simulator_rpc_client.SimulatorRpcClient._response_to_values()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#_response_to_values"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._response_to_values" class="py-name" href="#" onclick="return doclink('link-3', '_response_to_values', 'link-3');">_response_to_values</a></tt><tt class="py-op">(</tt><tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-string">"\r\n"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">query</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">" "</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">         </tt>
<a name="SimulatorRpcClient._response_to_values"></a><div id="SimulatorRpcClient._response_to_values-def"><a name="L34"></a><tt class="py-lineno"> 34</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient._response_to_values-toggle" onclick="return toggle('SimulatorRpcClient._response_to_values');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#_response_to_values">_response_to_values</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">response</tt><tt class="py-op">,</tt> <tt class="py-param">command</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient._response_to_values-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient._response_to_values-expanded"><a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">        <tt class="py-docstring">"""extract the return value from the response"""</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">        <tt class="py-name">prefix</tt> <tt class="py-op">=</tt> <tt class="py-name">command</tt> <tt class="py-op">+</tt> <tt class="py-string">" done: "</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">response</tt><tt class="py-op">.</tt><tt class="py-name">find</tt><tt class="py-op">(</tt><tt class="py-name">prefix</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">response</tt><tt class="py-op">[</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">prefix</tt><tt class="py-op">)</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">Exception</tt><tt class="py-op">(</tt><tt class="py-name">response</tt><tt class="py-op">)</tt> </tt>
</div><a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">         </tt>
<a name="SimulatorRpcClient.add_slave"></a><div id="SimulatorRpcClient.add_slave-def"><a name="L42"></a><tt class="py-lineno"> 42</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.add_slave-toggle" onclick="return toggle('SimulatorRpcClient.add_slave');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#add_slave">add_slave</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.add_slave-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.add_slave-expanded"><a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">        <tt class="py-docstring">"""add a new slave with the given id"""</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"add_slave %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">)</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#_rpc_call"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-4', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.remove_slave"></a><div id="SimulatorRpcClient.remove_slave-def"><a name="L47"></a><tt class="py-lineno"> 47</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.remove_slave-toggle" onclick="return toggle('SimulatorRpcClient.remove_slave');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_slave">remove_slave</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.remove_slave-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.remove_slave-expanded"><a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-docstring">"""add a new slave with the given id"""</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"remove_slave %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">)</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-5', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.remove_all_slaves"></a><div id="SimulatorRpcClient.remove_all_slaves-def"><a name="L52"></a><tt class="py-lineno"> 52</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.remove_all_slaves-toggle" onclick="return toggle('SimulatorRpcClient.remove_all_slaves');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_all_slaves">remove_all_slaves</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.remove_all_slaves-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.remove_all_slaves-expanded"><a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-docstring">"""add a new slave with the given id"""</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"remove_all_slaves"</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-6', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">         </tt>
<a name="SimulatorRpcClient.has_slave"></a><div id="SimulatorRpcClient.has_slave-def"><a name="L57"></a><tt class="py-lineno"> 57</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.has_slave-toggle" onclick="return toggle('SimulatorRpcClient.has_slave');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#has_slave">has_slave</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.has_slave-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.has_slave-expanded"><a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">        <tt class="py-docstring">"""add a new slave with the given id"""</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"has_slave %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">)</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-string">"1"</tt><tt class="py-op">==</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-7', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
</div><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.add_slave"></a><div id="SimulatorRpcClient.add_slave-def"><a name="L64"></a><tt class="py-lineno"> 64</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.add_slave-toggle" onclick="return toggle('SimulatorRpcClient.add_slave');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#add_slave">add_slave</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.add_slave-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.add_slave-expanded"><a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">        <tt class="py-docstring">"""add a new slave with the given id"""</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"add_slave %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">)</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-8" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-8', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.add_block"></a><div id="SimulatorRpcClient.add_block-def"><a name="L69"></a><tt class="py-lineno"> 69</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.add_block-toggle" onclick="return toggle('SimulatorRpcClient.add_block');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#add_block">add_block</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">,</tt> <tt class="py-param">block_name</tt><tt class="py-op">,</tt> <tt class="py-param">block_type</tt><tt class="py-op">,</tt> <tt class="py-param">starting_address</tt><tt class="py-op">,</tt> <tt class="py-param">length</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.add_block-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.add_block-expanded"><a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-docstring">"""add a new modbus block into the slave"""</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"add_block %d %s %d %d %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">,</tt> <tt class="py-name">block_name</tt><tt class="py-op">,</tt> <tt class="py-name">block_type</tt><tt class="py-op">,</tt> <tt class="py-name">starting_address</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt><tt class="py-op">)</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-9', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.remove_block"></a><div id="SimulatorRpcClient.remove_block-def"><a name="L74"></a><tt class="py-lineno"> 74</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.remove_block-toggle" onclick="return toggle('SimulatorRpcClient.remove_block');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_block">remove_block</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">,</tt> <tt class="py-param">block_name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.remove_block-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.remove_block-expanded"><a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-docstring">"""remove the modbus block with the given name and slave"""</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"remove_block %d %s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">,</tt> <tt class="py-name">block_name</tt><tt class="py-op">)</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-10', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.remove_all_blocks"></a><div id="SimulatorRpcClient.remove_all_blocks-def"><a name="L79"></a><tt class="py-lineno"> 79</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.remove_all_blocks-toggle" onclick="return toggle('SimulatorRpcClient.remove_all_blocks');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_all_blocks">remove_all_blocks</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.remove_all_blocks-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.remove_all_blocks-expanded"><a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-docstring">"""remove the modbus block with the given name and slave"""</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"remove_all_blocks %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-11', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.set_values"></a><div id="SimulatorRpcClient.set_values-def"><a name="L84"></a><tt class="py-lineno"> 84</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.set_values-toggle" onclick="return toggle('SimulatorRpcClient.set_values');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#set_values">set_values</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">,</tt> <tt class="py-param">block_name</tt><tt class="py-op">,</tt> <tt class="py-param">address</tt><tt class="py-op">,</tt> <tt class="py-param">values</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.set_values-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.set_values-expanded"><a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-docstring">"""set the values of registers"""</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"set_values %d %s %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">,</tt> <tt class="py-name">block_name</tt><tt class="py-op">,</tt> <tt class="py-name">address</tt><tt class="py-op">)</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">values</tt><tt class="py-op">:</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">            <tt class="py-name">query</tt> <tt class="py-op">+=</tt> <tt class="py-op">(</tt><tt class="py-string">" "</tt> <tt class="py-op">+</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-12', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">         </tt>
<a name="SimulatorRpcClient.get_values"></a><div id="SimulatorRpcClient.get_values-def"><a name="L91"></a><tt class="py-lineno"> 91</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.get_values-toggle" onclick="return toggle('SimulatorRpcClient.get_values');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#get_values">get_values</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">slave_id</tt><tt class="py-op">,</tt> <tt class="py-param">block_name</tt><tt class="py-op">,</tt> <tt class="py-param">address</tt><tt class="py-op">,</tt> <tt class="py-param">length</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.get_values-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.get_values-expanded"><a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-docstring">"""get the values of some registers"""</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"get_values %d %s %d %d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">slave_id</tt><tt class="py-op">,</tt> <tt class="py-name">block_name</tt><tt class="py-op">,</tt> <tt class="py-name">address</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt><tt class="py-op">)</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-name">ret_values</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-13', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">ret_values</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">' '</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt>     </tt>
</div><a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"> </tt>
<a name="SimulatorRpcClient.install_hook"></a><div id="SimulatorRpcClient.install_hook-def"><a name="L97"></a><tt class="py-lineno"> 97</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.install_hook-toggle" onclick="return toggle('SimulatorRpcClient.install_hook');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#install_hook">install_hook</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">hook_name</tt><tt class="py-op">,</tt> <tt class="py-param">fct_name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.install_hook-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.install_hook-expanded"><a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"install_hook %s %s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hook_name</tt><tt class="py-op">,</tt> <tt class="py-name">fct_name</tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-name">ret_values</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-14', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div><a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">         </tt>
<a name="SimulatorRpcClient.uninstall_hook"></a><div id="SimulatorRpcClient.uninstall_hook-def"><a name="L101"></a><tt class="py-lineno">101</tt> <a class="py-toggle" href="#" id="SimulatorRpcClient.uninstall_hook-toggle" onclick="return toggle('SimulatorRpcClient.uninstall_hook');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#uninstall_hook">uninstall_hook</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">hook_name</tt><tt class="py-op">,</tt> <tt class="py-param">fct_name</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="SimulatorRpcClient.uninstall_hook-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="SimulatorRpcClient.uninstall_hook-expanded"><a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-name">query</tt> <tt class="py-op">=</tt> <tt class="py-string">"uninstall_hook %s %s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">hook_name</tt><tt class="py-op">,</tt> <tt class="py-name">fct_name</tt><tt class="py-op">)</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-name">ret_values</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient._rpc_call" class="py-name" href="#" onclick="return doclink('link-15', '_rpc_call', 'link-4');">_rpc_call</a></tt><tt class="py-op">(</tt><tt class="py-name">query</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">         </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">"__main__"</tt><tt class="py-op">:</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">    <tt class="py-name">modbus_simu</tt> <tt class="py-op">=</tt> <tt id="link-16" class="py-name" targets="Class modbus_tk.simulator_rpc_client.SimulatorRpcClient=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient" class="py-name" href="#" onclick="return doclink('link-16', 'SimulatorRpcClient', 'link-16');">SimulatorRpcClient</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">    <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Method modbus_tk.modbus.Databank.remove_all_slaves()=modbus_tk.modbus.Databank-class.html#remove_all_slaves,Method modbus_tk.modbus.Server.remove_all_slaves()=modbus_tk.modbus.Server-class.html#remove_all_slaves,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_all_slaves()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_all_slaves"><a title="modbus_tk.modbus.Databank.remove_all_slaves
modbus_tk.modbus.Server.remove_all_slaves
modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_all_slaves" class="py-name" href="#" onclick="return doclink('link-17', 'remove_all_slaves', 'link-17');">remove_all_slaves</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method modbus_tk.modbus.Databank.add_slave()=modbus_tk.modbus.Databank-class.html#add_slave,Method modbus_tk.modbus.Server.add_slave()=modbus_tk.modbus.Server-class.html#add_slave,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_slave()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#add_slave"><a title="modbus_tk.modbus.Databank.add_slave
modbus_tk.modbus.Server.add_slave
modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_slave" class="py-name" href="#" onclick="return doclink('link-18', 'add_slave', 'link-18');">add_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method modbus_tk.modbus.Slave.add_block()=modbus_tk.modbus.Slave-class.html#add_block,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_block()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#add_block"><a title="modbus_tk.modbus.Slave.add_block
modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_block" class="py-name" href="#" onclick="return doclink('link-19', 'add_block', 'link-19');">add_block</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"toto"</tt><tt class="py-op">,</tt> <tt id="link-20" class="py-name"><a title="modbus_tk" class="py-name" href="#" onclick="return doclink('link-20', 'modbus_tk', 'link-0');">modbus_tk</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="modbus_tk.defines" class="py-name" href="#" onclick="return doclink('link-21', 'defines', 'link-1');">defines</a></tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Variable modbus_tk.defines.COILS=modbus_tk.defines-module.html#COILS"><a title="modbus_tk.defines.COILS" class="py-name" href="#" onclick="return doclink('link-22', 'COILS', 'link-22');">COILS</a></tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-number">100</tt><tt class="py-op">)</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Method modbus_tk.modbus.Slave.set_values()=modbus_tk.modbus.Slave-class.html#set_values,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.set_values()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#set_values"><a title="modbus_tk.modbus.Slave.set_values
modbus_tk.simulator_rpc_client.SimulatorRpcClient.set_values" class="py-name" href="#" onclick="return doclink('link-23', 'set_values', 'link-23');">set_values</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"toto"</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">,</tt> <tt class="py-number">8</tt><tt class="py-op">,</tt> <tt class="py-number">7</tt><tt class="py-op">,</tt> <tt class="py-number">6</tt><tt class="py-op">,</tt> <tt class="py-number">41</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Method modbus_tk.modbus.Slave.get_values()=modbus_tk.modbus.Slave-class.html#get_values,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.get_values()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#get_values"><a title="modbus_tk.modbus.Slave.get_values
modbus_tk.simulator_rpc_client.SimulatorRpcClient.get_values" class="py-name" href="#" onclick="return doclink('link-24', 'get_values', 'link-24');">get_values</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"toto"</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-number">5</tt><tt class="py-op">)</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="modbus_tk.modbus.Slave.set_values
modbus_tk.simulator_rpc_client.SimulatorRpcClient.set_values" class="py-name" href="#" onclick="return doclink('link-25', 'set_values', 'link-23');">set_values</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"toto"</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="modbus_tk.modbus.Slave.get_values
modbus_tk.simulator_rpc_client.SimulatorRpcClient.get_values" class="py-name" href="#" onclick="return doclink('link-26', 'get_values', 'link-24');">get_values</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"toto"</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-number">5</tt><tt class="py-op">)</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#has_slave"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave" class="py-name" href="#" onclick="return doclink('link-27', 'has_slave', 'link-27');">has_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="modbus_tk.modbus.Slave.add_block
modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_block" class="py-name" href="#" onclick="return doclink('link-28', 'add_block', 'link-19');">add_block</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"titi"</tt><tt class="py-op">,</tt> <tt id="link-29" class="py-name"><a title="modbus_tk" class="py-name" href="#" onclick="return doclink('link-29', 'modbus_tk', 'link-0');">modbus_tk</a></tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="modbus_tk.defines" class="py-name" href="#" onclick="return doclink('link-30', 'defines', 'link-1');">defines</a></tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="modbus_tk.defines.COILS" class="py-name" href="#" onclick="return doclink('link-31', 'COILS', 'link-22');">COILS</a></tt><tt class="py-op">,</tt> <tt class="py-number">100</tt><tt class="py-op">,</tt> <tt class="py-number">100</tt><tt class="py-op">)</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name" targets="Method modbus_tk.modbus.Slave.remove_block()=modbus_tk.modbus.Slave-class.html#remove_block,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_block()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_block"><a title="modbus_tk.modbus.Slave.remove_block
modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_block" class="py-name" href="#" onclick="return doclink('link-32', 'remove_block', 'link-32');">remove_block</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">,</tt> <tt class="py-string">"titi"</tt><tt class="py-op">)</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="modbus_tk.modbus.Databank.add_slave
modbus_tk.modbus.Server.add_slave
modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_slave" class="py-name" href="#" onclick="return doclink('link-33', 'add_slave', 'link-18');">add_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">25</tt><tt class="py-op">)</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave" class="py-name" href="#" onclick="return doclink('link-34', 'has_slave', 'link-27');">has_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">25</tt><tt class="py-op">)</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="modbus_tk.modbus.Databank.add_slave
modbus_tk.modbus.Server.add_slave
modbus_tk.simulator_rpc_client.SimulatorRpcClient.add_slave" class="py-name" href="#" onclick="return doclink('link-35', 'add_slave', 'link-18');">add_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">28</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">    <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name" targets="Method modbus_tk.modbus.Databank.remove_slave()=modbus_tk.modbus.Databank-class.html#remove_slave,Method modbus_tk.modbus.Server.remove_slave()=modbus_tk.modbus.Server-class.html#remove_slave,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_slave()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_slave"><a title="modbus_tk.modbus.Databank.remove_slave
modbus_tk.modbus.Server.remove_slave
modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_slave" class="py-name" href="#" onclick="return doclink('link-36', 'remove_slave', 'link-36');">remove_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">25</tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave" class="py-name" href="#" onclick="return doclink('link-37', 'has_slave', 'link-27');">has_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">25</tt><tt class="py-op">)</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave" class="py-name" href="#" onclick="return doclink('link-38', 'has_slave', 'link-27');">has_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">28</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">    <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name" targets="Method modbus_tk.modbus.Slave.remove_all_blocks()=modbus_tk.modbus.Slave-class.html#remove_all_blocks,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_all_blocks()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#remove_all_blocks"><a title="modbus_tk.modbus.Slave.remove_all_blocks
modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_all_blocks" class="py-name" href="#" onclick="return doclink('link-39', 'remove_all_blocks', 'link-39');">remove_all_blocks</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">)</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">    <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="modbus_tk.modbus.Databank.remove_all_slaves
modbus_tk.modbus.Server.remove_all_slaves
modbus_tk.simulator_rpc_client.SimulatorRpcClient.remove_all_slaves" class="py-name" href="#" onclick="return doclink('link-40', 'remove_all_slaves', 'link-17');">remove_all_slaves</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave" class="py-name" href="#" onclick="return doclink('link-41', 'has_slave', 'link-27');">has_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">28</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="modbus_tk.simulator_rpc_client.SimulatorRpcClient.has_slave" class="py-name" href="#" onclick="return doclink('link-42', 'has_slave', 'link-27');">has_slave</a></tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">)</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">    <tt class="py-name">modbus_simu</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Function modbus_tk.hooks.install_hook()=modbus_tk.hooks-module.html#install_hook,Method modbus_tk.simulator_rpc_client.SimulatorRpcClient.install_hook()=modbus_tk.simulator_rpc_client.SimulatorRpcClient-class.html#install_hook"><a title="modbus_tk.hooks.install_hook
modbus_tk.simulator_rpc_client.SimulatorRpcClient.install_hook" class="py-name" href="#" onclick="return doclink('link-43', 'install_hook', 'link-43');">install_hook</a></tt><tt class="py-op">(</tt><tt class="py-string">"modbus.Server.before_handle_request"</tt><tt class="py-op">,</tt> <tt class="py-string">"print_me"</tt><tt class="py-op">)</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/modbus-tk/">Modbus Test Kit</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed May 26 17:43:07 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
